<?php
function smarty_modifier_fileSize($string) {
	$size = intval($string);
	
	$level = 0;
	
	while($size > 1024) {
		$level++;
		$size /= 1024;	
	}
	
	$level_array = Array('B','KB','MB','GB','TB','PB');
	
	if($size == intval($size))return $size.' '.$level_array[$level];
	else return sprintf("%01.2f",$size).' '.$level_array[$level];
}